Skip to main content

ComponentTests

Stacked Bar Chart – Component test plan

Sub-components: Bar, Legends, Callout, Benchmark

  1. Bar: bar data, bar background color
  2. Legends: show/hide legends, highlight the corresponding bar on legend hover
  3. Callout: Default/custom callout
  4. Benchmark: Show benchmark
  5. Screen resolution changes, theme changes
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, non-empty dataRenders stacked bar chart correctlyEnzyme
- With empty dataRenders stacked bar chart correctlyRTL
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideTooltip prop set to “true”Should hide the tooltip in chartEnzyme
- With HideNumberDisplay set to “true”Should not show number/ratio on top of barEnzyme
- With HideDenominator set to “true”Should not show the denominator for the ratio above the chartEnzyme
- With IgnoreFixStyle set to “true”Should ignore the fixed display pattern for less than 2 data points chartEnzyme
- With EnabledLegendsWrapLines set to “true”Should enable the legends to wrap lines if there is not enough space to show all legends on a single lineEnzyme
Test 2: Basic props testing
- HideLegend prop set to “false”Should mount legend when hideLegend is falseEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- HideDenominator set to “false”Should not mount calloutEnzyme
- onRenderCalloutPerDataPoint is givenShould render onRenderCalloutPerDataPointEnzyme
- onRenderCalloutPerDataPoint is not givenShould not render onRenderCalloutPerDataPointEnzyme
Test 3: Render calling with respective to props
- No prop changes: Mount vertical bar chart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount vertical bar chart and then set the some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a barShould render callout correctly on mouseoverEnzyme
- Mouse over on a bar with customized calloutShould render customized callout on mouseoverEnzyme
- Mouse move on a barShould render callout correctly on mousemoveEnzyme
Test 5: Render empty chart aria label div when chart is empty
- Stacked bar chart mounted with non-empty dataNo empty chart aria label div renderedEnzyme
- Stacked bar chart mounted with empty dataEmpty chart aria label div renderedEnzyme
Test 6: [Sub-Component]: Stacked Bar
- Specify bar heightShould render the bar with the given heightRTL
- Specify bar background colorShould render the empty bars with the specified colorRTL
- Localize the numbers of the bars with a given cultureShould render the bars with the numbers localized in the given cultureE2E
- Specify the href for the stacked barShould redirect to the Url to upon clicking on the stacked bar chartE2E
- Specify data with only one single data pointShould render the number on top of the bar with only one data pointRTL
- Specify data with two data pointsShould render the ratio on top of the bar with only two data pointsRTL
- Specify data with more than two data pointsShould not render the ratio on top of the bar with data points count greater than twoRTL
- Specify target data propShould render a coloured arrow on top when target data is specifiedRTL
- Specify chartDataAccessibilityData prop when data contains two data pointsShould enable chartDataAccessibilityData prop only if ratio or numbers are enabled to be shownRTL
Test 7: [Sub-Component]: Benchmarking
- Specify the benchmark data pointShould render the benchmark triangleRTL
Test 8: [Sub-Component]: Legends
- Hover mouse over bar legendsShould reduce the opacity of the other bars/lines and their legendsRTL
- Hover mouse over benchmark legendsShould not reduce the opacity of the other bars/lines and their legendsRTL
- Mouse out from a bar legendShould change the opacity of the other bars and their legends on mouse out action from a bar legendRTL
- Click on a bar legendShould reduce the opacity of the other bars and their legends on mouse click a bar legendRTL
- Legends overflow scenarioOverflow button should contain the additional legendsE2E
- Specify placeholder as true for a data pointShould not show legend if data is marked as placeholderRTL
Test 9: [Sub-Component]: Callout
- Hover mouse over a barShould call the handler on mouse over barRTL
- Hover mouse over a barShould show the default callout over that barRTL
- Specify custom callout and hover mouse over a barShould show the custom callout over that barRTL
Test 10: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 11: Theme changed to Dark ThemeShould reflect theme changeRTL